package idz.validators;

import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;

public class PasswordValidator implements Validator
{
	public void validate(FacesContext arg0, UIComponent arg1, Object arg2) throws ValidatorException
	{
        String password = (String)arg1.getAttributes().get("password");
        String confirm = (String)arg2;

        if (!password.equals(confirm))
        {
        	throw new ValidatorException(new FacesMessage("Źle powtórzone hasło!"));
        }
	}
}
